package com.yaolonga.dc.examples.mybatisplus.controller;

import com.yaolonga.dc.examples.mybatisplus.entity.User;
import com.yaolonga.dc.core.DCPage;
import com.yaolonga.dc.core.DcExecutorManager;
import com.yaolonga.dc.core.model.SearchModel;
import com.yaolonga.dc.exector.mybatisplus.DefaultExecutorType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yaolong
 * @version V1.0.0
 * @program dynamic-condition
 * @description
 * @create 2024-06-01 18:07
 **/
@RestController
@RequestMapping("/api")
@CrossOrigin
public class ConditionController {
    @RequestMapping("/page")
    public Map<String,Object> page(@RequestBody SearchModel model){
        DCPage<User> r2dbc = DcExecutorManager.getExecutor(DefaultExecutorType.mybatis_plus).executePage(model, User.class);
        HashMap<String, Object> map = new HashMap<>();
        map.put("result",r2dbc);
        return map;
    }

}
